home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / samples / innwatch.ctl < prev    next >
Text File  |  1993-01-29  |  3KB  |  39 lines

  1. ##  $Revision: 1.3 $
  2. ##  innwatch.ctl -- control file for innwatch.
  3. ##  Indicates what to run to test the state of the news system, and what
  4. ##  to do about it.  Format:
  5. ##    !state!when!command!test!limit!command!reason/comment
  6. ##  where
  7. ##    <!>        Delimiter; pick from [,:@;?!]
  8. ##    <state>        State to enter if true.
  9. ##    <when>        States we must be in to match.
  10. ##    <command>    Command to run to test condition.
  11. ##    <test>        Operator to use in test(1) command.
  12. ##    <limit>        Value to test against.
  13. ##    <command>    Command for innwatch to perform; use exit,
  14. ##            flush, go, pause, shutdown, skip, or throttle.
  15. ##    <reason>    Used in ctlinnd command (if needed).
  16.  
  17. ##  First, just exit innwatch if innd has gone away.
  18. ##  =()<!!! test -f @<_PATH_SERVERPID>@ && echo 0 || echo 1 ! eq ! 1 ! exit ! innd dead>()=
  19. !!! test -f /news/lib/innd/innd.pid && echo 0 || echo 1 ! eq ! 1 ! exit ! innd dead
  20.  
  21. ##  Next test the load average.  Above first threshold pause, above higher
  22. ##  threshold throttle, below restart limit undo whatever was done.
  23. ##  =()<!load!load hiload! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! lt ! @<INNWATCH_LOLOAD>@ ! go ! loadav>()=
  24. !load!load hiload! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! lt ! 1000 ! go ! loadav
  25. ##  =()<!hiload!+ load! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! gt ! @<INNWATCH_HILOAD>@ ! throttle ! loadav>()=
  26. !hiload!+ load! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! gt ! 5000 ! throttle ! loadav
  27. ##  =()<!load!+! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! gt ! @<INNWATCH_PAUSELOAD>@ ! pause ! loadav>()=
  28. !load!+! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! gt ! 4000 ! pause ! loadav
  29.  
  30. ##  If load is OK, check space (and inodes) on various filesystems
  31. ##  =()<!!! df . | awk 'NR == 2 { print $4 }' ! lt ! @<INNWATCH_SPOOLSPACE>@ ! throttle ! No space (spool)>()=
  32. !!! df . | awk 'NR == 2 { print $4 }' ! lt ! 3000 ! throttle ! No space (spool)
  33. ##  =()<!!! df @<_PATH_BATCHDIR>@ | awk 'NR == 2 { print $4 }' ! lt ! @<INNWATCH_BATCHSPACE>@ ! throttle ! No space (newsq)>()=
  34. !!! df /news/spool/out.going | awk 'NR == 2 { print $4 }' ! lt ! 1000 ! throttle ! No space (newsq)
  35. ##  =()<!!! df @<_PATH_NEWSLIB>@ | awk 'NR == 2 { print $4 }' ! lt ! @<INNWATCH_LIBSPACE>@ ! throttle ! No space (newslib)>()=
  36. !!! df /news/lib | awk 'NR == 2 { print $4 }' ! lt ! 3000 ! throttle ! No space (newslib)
  37. ##  =()<!!! df -i . | awk 'NR == 2 { print $3 }' ! lt ! @<INNWATCH_SPOOLNODES>@ ! throttle ! No space (spool inodes)>()=
  38. !!! df -i . | awk 'NR == 2 { print $3 }' ! lt ! 200 ! throttle ! No space (spool inodes)
  39.